home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource5
/
300_01
/
econ_plt.doc
< prev
next >
Wrap
Text File
|
1989-12-30
|
7KB
|
147 lines
DOCUMENTATION FOR ECON_PLT
PURPOSE: This program provides Z_chart plots of any data that is
appropriately plotted against dates along the abcissa (x-axis). Input
data is in the form of a table of values to be plotted. The first column
is the date and a separate plot is provided for each consecutive column
of values.
REFERENCE: "Marketing and Sales Forcasting Manual", by Gordon J. Bolt,
Prentice Hall, Second edition May, 1973.
GENERAL PROGRAM DESCRIPTION: The Z-chart is a forcasting tool. Trends
can be deduced from the shape of the curve. It is a line chart which
plots three different lines using the same periodic data. A moving
average total, a cumulative total, and the period data values are all
plotted on a single chart. The name for the chart arises from the
rough shape of the three lines plotted. With the number of periods (N)
along the x-axis, the top line of the 'Z' is the moving average total
for N periods. The diagonal line of the 'Z' is the cumulative total
for the last N periods of the data set, and the bottom line of the 'Z'
is formed by plotting a the actual per period data values. Note that
the last moving average total value plotted and the last cumulative
value plotted have the same value so that both lines meet at the upper
right corner of the 'Z'.
The upper line is the long term trend and indicates a rise if the line is
hooking upward, the diagonal line shape (upward hooking suggests a rising
trend) indicates the short term trend, and the bottom line can be
examined to cyclic variations.
To generate a 'Z' chart, the user prepares an ASCII text containing all
of the data to be plotted. Comments may be embedded in the textfile as
long as they are enclosed in curly braces. The dates are in the form,
yymmdd (year month date), so they can be easily sorted into date
sequence prior to plotting using the MSDOS sort function. The dates
are placed in the first column, and each suceeding column contains the
the data for each 'Z' chart to be plotted. A column title is placed
above each column. The column title appears on the Z-chart when it is
plotted.
Here is an example input file named <INPUT.INP>
{ Typical Weather data }
DATE RAINFALL TEMPERATURE HUMIDITY
870101 6.0 45.0 40.0
870201 6.5 38.0 45.0
870305 4.7 56.0 57.0
870401 5.7 65.0 60.0
870501 6.5 72.0 65.0
870605 4.7 75.0 80.0
870701 3.9 85.0 75.0
870801 3.9 88.0 70.0
870905 4.7 78.0 65.0
871001 3.2 72.0 60.0
871101 5.8 65.0 45.0
871205 4.7 56.0 48.0
{ End of Data }
USER INTERFACE DESCRIPTION: The program is executed by entering
"ECON_PLT". The user is then prompted for the file name of the input data
file. The file nane where the data is stored (i.e. INPUT.INP) is then
entered. The program will then prompt the user for the number of periods
to be summed for the moving average total and for the cumulative
totals. Next the 'Z' chart for the first column of data is plotted on
the screen labeled with the column heading. If graphics.com was run
befor the ECON_PLT was run you can print a hard copy of the chart using
the shift-print screen key on Epson compatible graphics printers. The
next and each suceeding column of data can be viewed by striking the
space bar. After the last column of data is plotted the program exits to
the operating system.
A. INPUT FILE DESCRIPTION: The ASCII file to be read by CONTOUR.EXE can
be typed up using a separate text editor. The file must be arranged as
follows:
Data
Line No. Data line description
-------- ------------------------------------------------------------
1 The first line is a series of column headings for each column.
The first column heading should be "DATE".
2 Each suceeding row begins with a date in the yymmdd form and
.. to .. then each sucessive column contains the periodic value
last corresponding to the column where it appears. The rows must
row be in date sequence.
NOTE: Lines containing only comments or which are blank
are not counted.
PROGRAM LIMITATIONS: This program is not universally applicable to all
situations encountered. The x-axis is labeled with only by the year and
the year is in scientific notation. Also if the values fluctuate from
plus to minus the Z-chart can be difficult to interpret.
The version of the program on the distribution disk require the use of a
CGA monitor. Object code for Borland's BGI CGA graphics driver is linked
to the program.
The C-language source code for the charting package (Quin-Curtis'
Scientific and Engineering Software written is Turbo C) is used by the
program but is not included because it is proprietary. I recommend the
package because of it many capabilities and reasonable price. The C-
language source for the main is provided and it demonstrates how easily
the dynamic arrays can be interfaced to the third party array handling
packages. The fact that this program is sizeable and that the source
code is short illustrates the power available using these two libraries
together.
VARIABLE DESCRIPTIONS:
rows : Number of input data rows
cols : Number of input data columns
toksize : Largest input token length
i,j,k,loops : Loop indexes and boundarys
move_ave : Moving average
cumul_tot : Cumulative total
no_pds : Number of data points to use for moving
averages and cumulative totals
xtitle[80] : String to hold plot title
filename[30] : Character variable to hold input filename
*data : Dynamic text array for input data
*headings : Dynamic text array for plot headings
*date : Dynamic text array for dates
*dataf : Dynamic float array for input data
*plot_data : Dynamic float array for plot values
date_min : Earliest date in data set
date_max : Latest date in data set
plot_max : Maximum value to be plotted
plot_min : Minimum value to be plotted
tic : Spacing of tic marks on plot